const z = function (): string {
  return "hello world";
};

// 箭头函数，你可以将一个函数的返回值作为箭头函数的返回值
const x = (): string => z();
console.log(x());

//  =前面表示你定义的这个函数是怎么样的函数，函数名是add，函数参数是a和b都是number类型，函数返回值是number
//  =后面表示你这个函数具体， 具体函数(a,b) => a+b
const add: (a: number, b: number) => number = (a, b) => a + b;
console.log(add(3, 7));

// 函数挑战
const lengthOfString = function (a: string) {
  return a.length;
};
console.log(lengthOfString("...wioo209aa"));

const maxFunc: (a: number, b: number) => number = (a, b) => (a > b ? a : b);
console.log(maxFunc(3, 2));

function isEven(num: number): boolean {
  return num % 2 === 0;
}
console.log(isEven(2));

const whatType = (a: any): string => typeof a;
console.log(whatType("wioo209aa"));
